﻿<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>


<isperp:grid url="task/task/listDetail" gridId="taskGrid" 
    sortname="code" sortorder="desc"
	processKey="taskProcess" 
	ondbClickRowEvent="taskGrid.edit(rowid);" >

	<jsp:attribute name="toolbar">
	<isperp:treeMenu id="taskMenu" targetGridId="taskGrid">
		<isperp:async enable="true" url="task/task/processMenu"></isperp:async>
		<isperp:callback onClick="taskMenuTree_onNodeClick"
				onAsyncSuccess="taskMenuTree_onNodeClickFirst();">
		</isperp:callback>
	</isperp:treeMenu>
	</jsp:attribute>

	<jsp:attribute name="searchbar">
	<table class="search-table">
		<tbody>
			<tr>
				<td align="right">名称：</td>
				<td><input type="text" field="name" op="cn">
					</td>
				<td align="right">项目：</td>
				<td><form:select path="projectId" field="project_id" op="eq"
							items="${projectId}" itemLabel="name" itemValue="id"
							cssClass="search" data-allow-empty="true" />
					</td>
				<td align="right">创建人：</td>
				<td><input type="text" field="creator_name" op="cn">
					</td>
			</tr>
			<tr>
				<td align="right">计划开始时间：</td>
				<td><input id="planStartTimeStart" type="date"
						field="plan_start_time" op="gt" style="width: 68px" />~<input
						id="planStartTimeEnd" name="closeDateEnd" type="date"
						field="plan_start_time" op="lt" style="width: 68px" />
					</td>
				<td align="right">计划完成时间：</td>
				<td><input id="planEndTimeStart" type="date"
						field="plan_end_time" op="gt" style="width: 68px" />~<input
						id="planEndTimeEnd" name="closeDateEnd" type="date"
						field="plan_end_time" op="lt" style="width: 68px" />
					</td>
				<td align="right">优先级：</td>
				<td><form:select path="taskPrioirties" field="priority" op="eq"
							items="${taskPrioirties}" itemLabel="name" itemValue="name"
							cssClass="search" data-allow-empty="true" />
					</td>
			</tr>
		</tbody>
	</table>
</jsp:attribute>
	<jsp:body>
	<isperp:column name="id" title="id" hidden="true"></isperp:column>

	<isperp:column name="delay_status" title="" hidden="true">
	</isperp:column>

	<isperp:column name="priority" title="" width="40"
			isFormatterFun="true" formatter="return statusFormatter(rowObject);">
	</isperp:column>

	<isperp:column name="code" title="编号" width="80">
	</isperp:column>
	<isperp:column name="name" title="名称" width="150">
	</isperp:column>
	<isperp:column name="plan_start_time" title="计划开始时间" width="100">
	 	</isperp:column>
	<isperp:column name="plan_end_time" title="计划完成时间" width="100">
	</isperp:column>
	<isperp:column name="status" title="状态" width="50">
	</isperp:column>
	<isperp:column name="creator_name" title="创建人" width="60">
	</isperp:column>
	<isperp:column name="project_name" title="所属项目" width="100">
	</isperp:column>
	</jsp:body>

</isperp:grid>

<script type="text/javascript">
	function statusFormatter(rowObject) {
		var p = 5;
		switch (rowObject.priority) {
		case "一级":
			p = 1;
			break;
		case "二级":
			p = 2;
			break;
		case "三级":
			p = 3;
			break;
		case "四级":
			p = 4;
			break;
		case "五级":
			p = 5;
			break;
		}
		html = "<img title='优先级："+p+"级' src='img/incident/p"+p+".png'>";
		if (rowObject.delay_status == 1) {

			html = html + "&nbsp;<img title='该任务已延期'  src='img/incident/sla_unusual.png'>";
		}
		return html;
	}
</script>